package Models;

import java.io.Serializable;
import java.util.List;

public class FGI implements Serializable {
	private static final long serialVersionUID = 1L;
	
    private int fgiID;
    private String fgiDescription;
    private long fgiQtyOnHand;
    private int fgiQtyAllocated;
    private int fgiQtyInProduction;
    private double fgiPrice;
    private long version;
    private BeerView beer;
    private PackageType packageType;
    private List<InventoryUsage> inventoryUsages;
    private List<SpclPrice> specialPrices;
    private double servingVesselVolume;
    
	public int getFgiID() {
		return fgiID;
	}
	public void setFgiID(int fgiID) {
		this.fgiID = fgiID;
	}
	public String getFgiDescription() {
		return fgiDescription;
	}
	public void setFgiDescription(String fgiDescription) {
		this.fgiDescription = fgiDescription;
	}
	public long getFgiQtyOnHand() {
		return fgiQtyOnHand;
	}
	public void setFgiQtyOnHand(long fgiQtyOnHand) {
		this.fgiQtyOnHand = fgiQtyOnHand;
	}
	public int getFgiQtyAllocated() {
		return fgiQtyAllocated;
	}
	public void setFgiQtyAllocated(int fgiQtyAllocated) {
		this.fgiQtyAllocated = fgiQtyAllocated;
	}
	public int getFgiQtyInProduction() {
		return fgiQtyInProduction;
	}
	public void setFgiQtyInProduction(int fgiQtyInProduction) {
		this.fgiQtyInProduction = fgiQtyInProduction;
	}
	public double getFgiPrice() {
		return fgiPrice;
	}
	public void setFgiPrice(double fgiPrice) {
		this.fgiPrice = fgiPrice;
	}
	public long getVersion() {
		return version;
	}
	public void setVersion(long version) {
		this.version = version;
	}
	public BeerView getBeer() {
		return beer;
	}
	public void setBeer(BeerView beer) {
		this.beer = beer;
	}
	public PackageType getPackageType() {
		return packageType;
	}
	public void setPackageType(PackageType packageType) {
		this.packageType = packageType;
	}
	public List<InventoryUsage> getInventoryUsages() {
		return inventoryUsages;
	}
	public void setInventoryUsages(List<InventoryUsage> inventoryUsages) {
		this.inventoryUsages = inventoryUsages;
	}
	public List<SpclPrice> getSpecialPrices() {
		return specialPrices;
	}
	public void setSpecialPrices(List<SpclPrice> specialPrices) {
		this.specialPrices = specialPrices;
	}
	public double getServingVesselVolume() {
		return servingVesselVolume;
	}
	public void setServingVesselVolume(double servingVesselVolume) {
		this.servingVesselVolume = servingVesselVolume;
	}
    
    public String getDisplayString(){
        return this.fgiDescription + " (" + Integer.toString(fgiID) + ")";
    }
    
    /***************************************************************************
     * Returns the price of the FGI based on the customer selected.
     * @param custID
     * @return price of fgi.
     **************************************************************************/
    public double getPrice(final int custID){
    	double price = this.getFgiPrice();
        if(this.getSpecialPrices()!=null){
            for(final SpclPrice sp : this.getSpecialPrices()){
                if(sp.getCustomerID() == custID){
                    price = sp.getPrice();
                }
            }
        }
        return price;
    }
}
